package com.lian.community.entity.user;

import com.qcloud.cos.utils.StringUtils;
import org.springframework.beans.factory.annotation.Value;

public class User {

    Integer id;
    String name;
    String password;
    String salt;

    public User() {
    }

    public boolean registerValid(int nameLength, int passwordMin, int passwordMax){
        if(StringUtils.isNullOrEmpty(name) || StringUtils.isNullOrEmpty(password)){
            return false;
        }
        if(password.length() < passwordMin || password.length() > passwordMax){
            return false;
        }
        if(name.length() > nameLength){
            return false;
        }
        return true;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                '}';
    }
}
